<?php
/* wwwschool project
Copyright (C) 2009  Phillip Aldridge
Email : info@imi21.com
Web site http://www.imi21.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

/**
 *
 *  wwwschool project
 *  File : WS3content.php
 *  
 * CLASS WS3_Content
 */  
 
 class WS3_Content {
 
  private $lid = null; 
  //private $module_id = null;
  private $name = null; 
  private $description = null; 
  private $active = false; 
  private $scoring_type = false;
  private $media_type = false;
  private $access_type = false;      
  private $position = false; 
      
  function __construct() {
   }
   
  function __destruct() {
   }
   
  // set Content id
  function setContentID($id=null) {
    
    $dbContent = new WS3_Database();
    $content_id = $dbContent->makeSafeInt($id);   
    $q="SELECT *
    FROM `content`
    WHERE 1
    AND id= '$content_id'
    LIMIT 1";

    if ($dbContent->query($q) && $dbContent->nextRecord() )
    {
      $this->id = $dbContent->f('id');
      $this->name = javaSafeString( $dbContent->f('name') );
      $this->description = javaSafeString( $dbContent->f('description') );
      $this->active = $dbContent->f('active');
      $this->module_id = $dbContent->f('module_id');
      //$this->position = $dbContent->f('position');
      $this->scoring_type = $dbContent->f('scoring_type');
      $this->media_type = $dbContent->f('media_type');
      $this->access_type = $dbContent->f('access_type');
      return true;
    }else{
    //if (W3DEBUG) array_push($GLOBALS['W3DEBUG'],"Content id not found !!");
      return false;
    }
   }
   
  // return Content id
  function ContentID() {
    if ($this->id)
    return $this->id;
    else
    return false; 
   }
   
  // return Module id
  function ModuleID() {
    if ($this->module_id)
    return $this->module_id;
    else
    return false; 
   }    
   
  // return Content name
  function ContentName() {
    if ($this->name)
    return $this->name;
    else
    return false; 
   }
   
   // return Content description
  function ContentDescription() {
    if ($this->description)
    return $this->description;
    else
    return false; 
   } 

  // return Content ScoringType
 function ContentScoringType() {
    if ($this->scoring_type )
    return $this->scoring_type;
    else
    return false; 
   }   
 
  // return Content MediaType
  function ContentMediaType() {
    if ($this->media_type )
    return $this->media_type;
    else
    return false; 
   }    
  
  // return Content AccessType
  function ContentAccessType() {
    if ($this->access_type )
    return $this->access_type;
    else
    return false; 
   }    
     
 } // end content class
 
 ?>
